package com.blueheart.music.service.impl;

import com.blueheart.music.exception.BaseException;
import com.blueheart.music.exception.BaseExceptionEnum;
import com.blueheart.music.mapper.AdminMapper;
import com.blueheart.music.model.pojo.Admin;
import com.blueheart.music.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AdminServiceImpl implements AdminService {
    @Autowired
    private AdminMapper adminMapper;
    @Override
    public Admin login(String name,String password) throws BaseException {
        Admin admin=adminMapper.selectByAdmin(name,password);
        if (admin==null){
            throw new BaseException(BaseExceptionEnum.LOGIN_ERROR);
        }
        return admin;
    }
}
